package com.qf.fileupload.config;

import com.qf.fileupload.filter.DemoFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class FilterConfig {

    @Bean
    public FilterRegistrationBean<DemoFilter> filterFilterRegistrationBean(){

        final FilterRegistrationBean<DemoFilter> demoFilterFilterRegistrationBean = new FilterRegistrationBean<>();

        demoFilterFilterRegistrationBean.addUrlPatterns("/demo");
        demoFilterFilterRegistrationBean.setFilter(new DemoFilter());

        return demoFilterFilterRegistrationBean;

    }

}
